<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
</head>

<body>
<canvas id="mycanvas" width="300" height="200"></canvas>
<script type="text/javascript">
	var x = document.getElementById("mycanvas")
	var cxt = x.getContext("2d")
	var qitayanse = cxt.createLinearGradient(0,0,180,50)
	qitayanse.addColorStop(0,"#F00")
	qitayanse.addColorStop(1,"#0f0")
	cxt.fillStyle = qitayanse
	cxt.fillRect(0,0,175,50)
</script>
</body>
</html>
